﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace iLangl.Customer.DAL
{
	public class DALFacadeConfiguration : ConfigurationSection
	{
		private static ConfigurationProperty storageTypeProperty;
		
		private static DALFacadeConfiguration instance;
		private static ConfigurationPropertyCollection properties;

		static DALFacadeConfiguration()
		{
			storageTypeProperty = new ConfigurationProperty(
			  "storageType",
			  typeof(String),
			  null,
			  ConfigurationPropertyOptions.IsRequired);

			
			properties = new ConfigurationPropertyCollection();
			properties.Add(storageTypeProperty);
			
		}

		private static object mutex = new object();
		/// <summary>
		/// The instance of the ConfigurationProperty.
		/// </summary>
		public static DALFacadeConfiguration Instance
		{
			get
			{
				if (instance == null)
				{
					lock (mutex)
					{
						if (instance == null)
						{
							instance = ConfigurationManager.GetSection("DALFacadeConfiguration") as DALFacadeConfiguration;
						}
					}
				}
				return instance;
			}
		}

		/// <summary>
		/// Get the type of current Storage.
		/// </summary>
		public String StorageType
		{
			get
			{
				return base[storageTypeProperty] as String;
			}
		}

		protected override ConfigurationPropertyCollection Properties
		{
			get
			{
				return properties;
			}
		}
	}
}